package io.renren.modules.hospital.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.hospital.dao.EmrBlInfoDao;
import io.renren.modules.hospital.entity.EmrBlInfoEntity;
import io.renren.modules.hospital.service.EmrBlInfoService;


@Service("emrBlInfoService")
public class EmrBlInfoServiceImpl extends ServiceImpl<EmrBlInfoDao, EmrBlInfoEntity> implements EmrBlInfoService {

    @Autowired
    EmrBlInfoDao blInfoDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<EmrBlInfoEntity> page = this.page(
                new Query<EmrBlInfoEntity>().getPage(params),
                new QueryWrapper<EmrBlInfoEntity>()
        );

        return new PageUtils(page);
    }

    /**
     * 根据患者id查找病历
     *
     * @param hzId 患者编号
     * @return 病历实体
     */
    public EmrBlInfoEntity getBlByHzId(Integer hzId) {
        return blInfoDao.getBlByHzId(hzId);
    }

    @Override
    public List<EmrBlInfoEntity> findBlList() {
        return blInfoDao.findBlList();
    }

    @Override
    public Boolean updateTime(Integer blId, String time) {
        return blInfoDao.updateTime(blId, time);
    }

}
